package animation;

import main.pak.R;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipDescription;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class MyDrag extends Activity {
	private static final String IMAGEVIEW_TAG = "icon bitmap";
	Bitmap _bball;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		_bball = BitmapFactory
				.decodeResource(getResources(), R.drawable.biball);
		final ImageView v_imageView = new ImageView(this);

		v_imageView.setImageBitmap(_bball);

		v_imageView.setTag(IMAGEVIEW_TAG);

		v_imageView.setOnLongClickListener(new View.OnLongClickListener() {

			@Override
			public boolean onLongClick(View v) {
				// TODO Auto-generated method stub
				ClipData.Item item = new ClipData.Item((CharSequence) v
						.getTag());

				String[] clipDesc = { ClipDescription.MIMETYPE_TEXT_PLAIN };
				ClipData dragData = new ClipData((CharSequence) v.getTag(),
						clipDesc, item);

				View.DragShadowBuilder myShadow = new MyDragShadowBuilder(
						v_imageView);

				v.startDrag(dragData, myShadow, null, 0);
				return false;
			}

		});
	}
}
